import { ApiProperty } from '@nestjs/swagger';
import { IsString, IsOptional, IsNumber, IsArray, IsEnum, IsBoolean, IsInt } from 'class-validator';
import { Type } from 'class-transformer';

/**
 * 创建投注选项DTO
 */
export class CreateBettingDto {
  @ApiProperty({ 
    description: '竞彩编号',
    example: '135',
    required: false 
  })
  @IsOptional()
  @IsString()
  jingcaiNumber?: string;

  @ApiProperty({ 
    description: '北单编号',
    example: '周一001',
    required: false 
  })
  @IsOptional()
  @IsString()
  beidanNumber?: string;
  @ApiProperty({ 
    description: '竞彩单关',
    example: '0',
    required: false 
  })
  @IsOptional()
  @IsString()
  jingcaiSingle?: string;

  @ApiProperty({ 
    description: '竞彩让球',
    example: 0,
    required: false 
  })
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  jingcaiHandicap?: number;

  @ApiProperty({ 
    description: '北单让球',
    example: 0,
    required: false 
  })
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  beidanHandicap?: number;

  @ApiProperty({ 
    description: '胜赔率',
    example: 2.91,
    required: false 
  })
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  winOdds?: number;

  @ApiProperty({ 
    description: '平赔率',
    example: 4.33,
    required: false 
  })
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  drawOdds?: number;

  @ApiProperty({ 
    description: '负赔率',
    example: 2.34,
    required: false 
  })
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  loseOdds?: number;

  @ApiProperty({ 
    description: '推荐结果',
    example: ["win", "draw"],
    type: [String],
    required: false 
  })
  @IsOptional()
  @IsArray()
  @IsEnum(['win', 'draw', 'lose'], { each: true })
  recommendedResult?: string[];

  @ApiProperty({ 
    description: '主队比分',
    example: 2,
    required: false 
  })
  @IsOptional()
  @IsInt()
  @Type(() => Number)
  homeScore?: number;

  @ApiProperty({ 
    description: '客队比分',
    example: 1,
    required: false 
  })
  @IsOptional()
  @IsInt()
  @Type(() => Number)
  awayScore?: number;

  @ApiProperty({ 
    description: '比赛结果',
    example: 'win',
    enum: ['win', 'draw', 'lose'],
    required: false 
  })
  @IsOptional()
  @IsEnum(['win', 'draw', 'lose'])
  matchResult?: string;

  @ApiProperty({ 
    description: '预测是否命中',
    example: true,
    required: false 
  })
  @IsOptional()
  @IsBoolean()
  predictionHit?: boolean;
}